// pages/personal_info/personal_info.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    value: '',
    EId:"",
    EName:"",
    EPhone:"",
    EEmail:"",
    ECredit:"",
     // 底部tabbar start
     tabbar_active: 2,
     tabbar_list: [{
       "url": "../recive_order/recive_order",
       "text": "接单",
       "icon": "todo-list",
       "info": 12,
     }, {
       "url": "../order_list/order_list",
       "text": "订单",
       "icon": "column",
      //  "info": 99,
     }, {
       "url": "../personal_info/personal_info",
       "text": "我的",
       "icon": "smile"
     }, {
       "url": "../contact/contact",
       "text": "关于",
       "icon": "phone-circle"
     }],
     // 底部tabbar end
 
  },


 tabbar_onChange: function (res) {
    // this.setData({
    //   tabbar_active: res.detail
    // });
    // console.log(this.data.tabbar_list[res.detail].url);
    wx.navigateTo({
      url: this.data.tabbar_list[res.detail].url+"?Id="+this.data.EId,
    });
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      EId:options.Id
    });
    const that = this;
    wx.request({
      url: 'http://localhost:8088/getEmployeeTaskToSelect',
      method:"GET",
      data:{
        EId: this.data.EId,
      },
      header: { 'content-type': 'application/x-www-form-urlencoded' },
      success(res){
        console.log(res.data);
        var index = 0;
        var info = 'tabbar_list['+ index + '].info';
        that.setData({
            elements:res.data,
            [info]:res.data.length
        })
      }
    });
    wx.request({
      url: 'http://localhost:8088/getMyEmployee',
      method:'GET',
      data:{
        EId : this.data.EId,
      },
      success(res){
        var data1 = res.data;
        that.setData({
          EName:data1.eName,
          EPhone:data1.ePhone,
          ECredit:data1.eCredit,
          EEmail:data1.eEmail,
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    this.setData({
      loading: false,
    });
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})